package IOMyhead;

import java.io.*;
import java.util.Random;

public class GenNumber {
    public static void main(String[] args) {
        Random random = new Random();
        int randomnumber;
        File file = new File("C:\\Users\\wangzihong\\Desktop\\20175209\\课上练习及课下作业\\src\\IOMyhead","20175209.txt");
        if(!file.exists()) {
            try {
                file.createNewFile();
                System.out.println("创建成功");
            }
            catch(IOException exp){ }
        }
        String a="";
        try {
            FileWriter out = new FileWriter(file,true);
            for(int i=0;i<209;i++) {
                randomnumber = random.nextInt(5209)+1;
                a = randomnumber + "" +"\r\n";
                out.write(a);
            }
            out.close();
        }
        catch(IOException e) {}
    }
}
